var Enemy = function (parent, enemyID) {
	"use strict";
	this.id = enemyID;
	this.difficulty = 0;
	this.health = Math.floor(Math.random() * 5);
	this.words = {};

	Enemy.prototype.init = function () {
		this.render(parent);
		this.generateWords();
	};
	Enemy.prototype.generateWords = function () {
		var i, word, numWords = Dictionary.length;
		this.div = $('#enemy' + enemyID);
		this.div.hide();
		for (i = 0; i < this.health && Dictionary.length > 0; i += 1) {
			word = Dictionary.splice(0, 1);
			this.words[word] = new Word(this.div, word);
		}
		this.div.show();
	};
	Enemy.prototype.render = function (parent) {
		parent.append('<ul id="enemy' + this.id + '">');
	};
	Enemy.prototype.embolden = function (text) {
		var key, boldWords = [];
		for (key in this.words) {
			if (this.words.hasOwnProperty(key)) {
				if (key.indexOf(text) === 0) {
					this.words[key].embolden();
					boldWords.push(this.words[key]);
				} else {
					this.words[key].unEmbolden();
				}
			}
		}
		return boldWords;
	};
	Enemy.prototype.processWord = function (text) {
		var word = this.words[text];
		if (word !== null && word !== undefined) {
			word.destroy();
			delete this.words[text];
			this.health -= 1;
			if (this.health <= 0) {
				this.die();
			}
		}
	};
	Enemy.prototype.die = function () {
		this.div.html("I DIED");
	};
	this.init(parent);
};